package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.entity.NursingPlan;
import com.zzyl.vo.NursingPlanVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface NursingPlanMapper {
    /**
     * 条件分页查询
     * @param name
     * @param status
     * @return
     */
    Page<NursingPlanVo> getByPage(String planName, Integer status);

    /**
     * 查询所有护理计划
     * @return
     */
    @Select("select * from nursing_plan")
    List<NursingPlanVo> selectAllNursingPlan();

    /**
     * 新增
     * @param nursingPlan
     */
    @Insert("insert into nursing_plan(plan_name,status,create_time,update_time,create_by,update_by) " +
            "values (#{planName},#{status},#{createTime},#{updateTime},#{createBy},#{updateBy})")
    @Options(useGeneratedKeys = true,keyProperty = "id")
    void insertNursingPlan(NursingPlan nursingPlan);

    /**
     * 根据id查询
     * @param id
     * @return
     */
    NursingPlan getById(Long id);

    /**
     * 修改
     * @param nursingPlan
     */
    void updateNursingPlan(NursingPlan nursingPlan);

    /**
     * 删除
     * @param id
     */
    void deleteNursingPlan(List<Integer> id);

    /**
     * 启用禁用
     * @param id
     * @param status
     */
    void updateStatus(Integer id, Integer status);
}
